<template>
	<view class="max-box">
		<view class="main">
			<view class="login-authorization">
				<image src="/static/logo.png" class="login-image" mode=""></image>
				<view class="weChat-users">微信用户</view>
				<view class="weChat-authorization">微信授权登录</view>
				<button class="login-button" @click="login">
					<u-icon name="weixin-fill" color="#fff" size="28"></u-icon>
					<text>微信一键授权</text>
				</button>
				<view class="prompt">微信授权登录后才进行更多操作哦</view>
			</view>
		</view>
		<view class="footer">
			<u-checkbox-group @click="checkboxClick" @change="checkboxClick">
				<u-checkbox v-model="authorization" shape="circle"></u-checkbox>
			</u-checkbox-group>
			<view class="">
				已阅读并同意
				<text class="service-agreement">《服务协议》</text>和
				<text class="privacy-agreement">《隐私协议》</text>
			</view>
		</view>
		<u-notify ref="prompt" message="Hi uView"></u-notify>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 复选框授权
				authorization: false,
			}
		},
		methods: {
			// 登录跳转首页
			login() {
				if (this.authorization === true) {
					wx.switchTab({
						url: '/pages/index/index'
					})
				} else {
					// 也可以通过主题形式调用，如：
					this.$refs.prompt.warning('请勾选,已阅读并同意服务协议和隐私协议复选框')
				}
			},
			checkboxClick() {
				this.authorization = !this.authorization
			},
		}
	}
</script>

<style lang="scss" scoped>
	.max-box {
		height: 1400rpx;
		background-color: #FFFFFF;
	}

	.main {
		height: 1200rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.login-image {
		width: 125rpx;
		height: 125rpx;
		border-radius: 100%;
	}

	.login-authorization {
		text-align: center;
	}

	.weChat-users {
		color: #44403D;
	}

	.weChat-authorization {
		margin-top: 20rpx;
		font-weight: bold;
		font-size: 40rpx;
	}

	button::after {
		border: none;
	}

	button {
		padding-left: 20rpx;
		padding-right: 20rpx;
		text-align: center;
		line-height: 1.35;
		overflow: hidden;
		height: 100%;
	}

	.login-button {
		margin-top: 70rpx;
		background-color: #09BB07;
		width: 600rpx;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 40rpx;
		color: #fff;
		border-radius: 40rpx;
	}

	.prompt {
		margin-top: 20rpx;
		color: #A4A8BB;
	}

	.footer {
		display: flex;
		align-items: center;
		position: fixed;
		bottom: 0;
		padding: 0rpx 0rpx 60rpx 40rpx;

		.service-agreement {
			color: red;
		}

		.privacy-agreement {
			color: red;
		}
	}
</style>